package handle.query;

import common.Constants.ServiceConstant;
import common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import service.QueryService;
import service.TokenService;
import service.VerifyService;

/**
 * Created by lxl on 2015/11/5.
 */
@Controller
@RequestMapping("ssms/query")
public class QueryCourseListHandle {

    @Autowired
    private QueryService queryService ;

    @Autowired
    private VerifyService verifyService ;

    @Autowired
    private TokenService tokenService ;

    @RequestMapping(value = "/course/list" ,method = RequestMethod.POST)
    public @ResponseBody
    Result process( @RequestHeader String token ){

        Result result = verifyService.verify(token, ServiceConstant.ADMIN_LEVEL) ;

        if( result.isSucces() ){

            result = queryService.queryCourseList(0,0,ServiceConstant.ADMIN_LEVEL,null) ;

        }

        return  result ;
    }

}
